export class LitegraphUtils {
    public static findIndex(arr: any[], data: any, fields: string[]) {
        for (let i = 0; i < arr.length; i++) {
            const item = arr[i];
            let isEq = true;
            for (let j = 0; j < fields.length; j++) {
                const field = fields[j];
                if (item[field] !== data[field]) {
                    isEq = false;
                    break;
                }
            }
            if (isEq) {
                return i;
            }
        }
        return -1;
    }

    public static checkType(date: any) {
        let type = Object.prototype.toString.call(date);
        type = type.substr(8, type.length - 9);
        return type;
    }
}
